import request from '@/api/request'

export function login(data) {
  return request({
    url: '/user/login/',
    method: 'POST',
    data
  })
}

export function getUserInfo(token) {
  return request({
    url: '/user/user_info/',
    method: 'GET',
    params: { token }
  })
}

export function getWxUserInfo() {
  return request({
    url: '/member/wx_user_info/',
    method: 'GET',
  })
}

export function logout(data) {
  return request({
    url: '/user/logout/',
    method: 'POST',
    data
  })
}

export function getRetailers(params) {
  return request({
    url: '/member/retailer/',
    method: 'GET',
    params
  })
}


export function getAllRetailers(params) {
  return request({
    url: '/member/retailer_list/',
    method: 'GET',
    params
  })
}

export function updateRetailer(data) {
  return request({
    url: `/member/retailer/${data.id}/`,
    method: 'PUT',
    data
  })
}

// 用户充值记录开始
export function getRechargeRecords(params) {
  return request({
    url: '/wechat/recharge_record/',
    method: 'GET',
    params
  })
}

///////商家赠送积分
export function getBonusPoints(params) {
  return request({
    url: '/member/bonus_point/',
    method: 'GET',
    params
  })
}

///////客户积分消费

export function getPointConsumptions(params) {
  return request({
    url: '/member/point_consumption/',
    method: 'GET',
    params
  })
}

export function getBonusPointStats(params) {
  return request({
    url: '/member/bonus_stats/',
    method: 'GET',
    params
  })
}

export function getRechargeStats(params) {
  return request({
    url: '/wechat/recharge_stats/',
    method: 'GET',
    params
  })
}

export function getConsumeStats(params) {
  return request({
    url: '/member/consume_stats/',
    method: 'GET',
    params
  })
}